Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

POC of adding full Typescript support #159

Closed
wants to merge 2 commits into from
Closed

Conversation

tomenden
Copy link
Collaborator

@tomenden tomenden commented Nov 9, 2019

To play with it, create a corvid app and run npx tsc --build -w src.
You can add ts files and they will compile to JS.

AFAICT, there should be no degradation for JS users, so this should allow us to support TS out of the box. Let me know what you think and if I'm missing something. If all is well, I will fix the tests and add additional ones for the two new config files created

"public/*": ["../../public/*"]
}
"public/*": ["../../public/*"],
"backend/*": ["../../backend/*"]
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@agankarin
This allows importing from backend (which is good), but unfortunately, typescript ignores .jsw files. Regarding our previous discussions on supporting backend, and corvid-magic-sauce of wrapping calls to webMethods, I realized we actually don't need to do anything special! 🕺
The reason is, that the user should anyways write backend functions asynchronously. If they don't, they are making an error. So if the user writes async code in backend, and we will allow him to import functions from .jsw files, the secret sauce is all set and the user will get an awesome experience. The only minor (😆 ) problem left is that typescript does not seem to support custom file extensions, and it doesn't sound like it will support them in the near future:
microsoft/TypeScript#10939

@@ -18,13 +19,21 @@ let corvidTypes,
try {
corvidTypes = require("corvid-types");

const SHARED_COMPILER_OPTIONS = {
composite: true,
noEmit: false,
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@agankarin
Any particularly reason we currently have noEmit: true in the base configs in corvid-types?
I think if the user does not have any TS files then this flag will have no effect anyways.

@tomenden
Copy link
Collaborator Author

tomenden commented Nov 9, 2019

Makes use of Typescript Project References - https://www.typescriptlang.org/docs/handbook/project-references.html

cc @dor-itzhaki @agankarin @nemni8 - will be happy to hear your thoughts/comments

If you want to see it in action, follow the instructions here #159 (comment)

@agankarin agankarin closed this May 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants